package com.anlu.base.exception;

import com.anlu.base.model.errorcode.IErrCode;

import java.util.Arrays;

/**
 * <p>
 * Description:TODO 详细描述
 * <p>
 * <p>
 *
 * @author anlu
 * @date 2024/9/23 10:06
 */
public class BaseException extends RuntimeException {

    protected String errCode;

    protected String errMessage;

    protected String[] args;

    protected Object data;

    public BaseException() {
    }

    public BaseException(String message) {
        super(message);
    }

    public BaseException(String message, Throwable cause) {
        super(message, cause);
    }


    public BaseException(IErrCode errCode) {
        super(errCode.getErrCode() + " " + errCode.toString());
        this.errCode = errCode.getErrCode();

    }

    public BaseException(Exception e) {
    }


    public BaseException args(String... args) {
        if (args == null) {
            this.args = null;
        } else {
            this.args = Arrays.copyOf(args, args.length);
        }
        return this;
    }
}
